//
//  SHTextTableViewCell.m
//  SHChatUI
//
//  Created by CSH on 2018/11/28.
//  Copyright © 2018 CSH. All rights reserved.
//

#import "SHGoodCardTableViewCell.h"

@interface SHGoodCardTableViewCell ()

// text
@property (nonatomic, strong) SHTextView *textView;

@property (nonatomic, strong) UIImageView *iconView;

@property (nonatomic, strong) UILabel *titleLab;

@property (nonatomic, strong) UILabel *subTitleLab;

@property (nonatomic, strong) UILabel *priceLab;


@property (nonatomic, strong) UIButton *addBtn;

@end

@implementation SHGoodCardTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setMessageFrame:(SHMessageFrame *)messageFrame{
    [super setMessageFrame:messageFrame];
    
    SHMessage *message = messageFrame.message;

    self.bubbleBtn.backgroundColor = [UIColor yellowColor];
    [self.bubbleBtn makeMaskView];
    
    self.iconView.frame = CGRectMake(kChat_margin, kChat_margin, 80, 80);
    
    
    
    self.addBtn.frame = CGRectMake((self.bubbleBtn.width - 60)/2, messageFrame.contentF.size.height - 2 * kChat_margin - 25 , 60, 25);
    
}




#pragma mark 文本消息视图
- (SHTextView *)textView{
    //文本
    if (!_textView) {
        _textView = [[SHTextView alloc]init];
        _textView.editable = NO;
        _textView.scrollEnabled = NO;
        _textView.showsVerticalScrollIndicator = NO;
        [self.bubbleBtn addSubview:_textView];
    }
    return _textView;
}

- (UIImageView *)iconView {
    if (!_iconView) {
        _iconView = [[UIImageView alloc] init];
        _iconView.image = [UIImage imageNamed:@"headImage"];
        [self.bubbleBtn addSubview:_iconView];
    }
    return _iconView;
}

- (UIButton *)addBtn {
    if (!_addBtn) {
        _addBtn = [UIButton buttonWithType:0];
        [_addBtn setTitle:@"发送链接" forState:UIControlStateNormal];
        _addBtn.backgroundColor = [UIColor blueColor];
        [_addBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [self.bubbleBtn addSubview:_addBtn];
    }
    return _addBtn;
}

@end
